<#include "include/_meta.html">
<title>车辆审核列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理员管理 <span class="c-gray en">&gt;</span> 管理员列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c"> 
		车牌号码：
		<input type="text" class="input-text" style="width:250px" placeholder="车牌号码" id="carcode" name="carcode">
		车主手机：
		<input type="text" class="input-text" style="width:250px" placeholder="车主手机" id="mobile" name="mobile">
				
		<button type="submit" class="btn btn-success" id="searchCars" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20">    <span class="r">共有数据：<strong id="pageTotal">0</strong> 条</span> </div>
	<table id="checkListTable" class="table table-border table-bordered table-bg table-hover">
		<thead>
			<tr>
				<th scope="col" colspan="11">新车审核列表</th>
			</tr>
			<tr class="text-c">
			    <th >序号</th> 
				<th >车牌号码</th>
				<th >车辆颜色</th>
				<th >车主姓名</th>
				<th >车主手机</th>
				<th >车辆品牌</th>
				<th >品牌型号</th>
				<th >车辆类型</th>
				<th >车辆状态</th>
				<th >申请时间</th>
				<th>操作</th>
		</tr>
		</thead>
		<tbody>

		</tbody>
	</table>
</div>

<#include "include/_footer.html">

<script type="text/javascript">

$(function(){

    initTable();
  
});


var initTable = function(){

$('#checkListTable').dataTable( {
    	"processing": false,
      	"serverSide": true,
      	"bSort": false,
      	"bFilter":false,
      	"bLengthChange":false,
      	"iDisplayLength":10,
      	"bRetrieve":true,
      	"ajax": {
            "url": "/checkList/getlikecond",
           	"data":function(d){
		        d.carcode = $('#carcode').val();
		        d.mobile = $('#mobile').val();
		    	},
            "type": "get"
        },
        "columns": [
            {"data" : "carid"},
            { "data": "carcode" },
            { "data": "carcolor" },
            { "data": "name" },
            { "data": "mobile" },
            { "data": "carbrand" },
            { "data": "carbrandtype" },
            { "data": "cartype" },
            { "data": "" },
            { "data": "addtime" },
            { "data": "" }
      	],
//自定义列      	
      	"columnDefs": [
	        
	         {
                  "targets": [8],
                  "data": "carstate",
                  "render": function(data, type, full) {
                    if(full.carstate==1){
                        return "待审核";
                    }
                    if(full.carstate==5){
                        return "待上架";
                    }
                     if(full.carstate==2){
                        return "不合格";
                    }
                     if(full.carstate==3){
                        return "已报废";
                    }
                     if(full.carstate==4){
                        return "已删除";
                    }
                     if(full.carstate==6){
                        return "待租赁";
                    }
                     if(full.carstate==7){
                        return "自用中";
                    }
                     if(full.carstate==8){
                        return "维修中";
                    }
                     if(full.carstate==9){
                        return "保养中";
                    }
                       if(full.carstate==10){
                        return "年检中";
                    }
                       if(full.carstate==11){
                        return "已租赁";
                    }
                    
                  }
            },
	        {
		          "targets": [10],
		          "data": "id",
		          "render": function(data, type, full) {
		         
		          			var action_edit    = "<a title=\"审核\"  onclick=\"check_edit('车辆审核','/check-edit?carid="+full.carid+"','2','800','500')\" class=\"ml-5\" ><i class=\"Hui-iconfont\">审核</i></a>";
							var action_upedit    = "<a title=\"上架\"  onclick=\"putaway_edit('上架','/putaway-edit?carid="+full.carid+"','2','800','500')\" class=\"ml-5\" ><i class=\"Hui-iconfont\">上架</i></a>";		          
//根据车辆状态判断操作显示审核还是上架		            		
		            		if(full.carstate==1){
                                return action_edit;
                            }
                            if(full.carstate==5){
                                return action_upedit;
                            }
                            return "";
                  }
	        }	        
      	],
      	"fnRowCallback" : function(nRow, aData, iDisplayIndex) { 
                   nRow.className="text-c"; 
                   $('td:eq(0)', nRow).html(iDisplayIndex+1);
                   
                        return nRow;  
         },
	    "fnDrawCallback": function(oSettings) {
		      //获取后台方式 直接可以拿到json 之后进行处理
		      var json=jQuery.parseJSON(oSettings.jqXHR.responseText);  
		      $("#pageTotal").html(json.recordsTotal);
	    }     	
    });

}


$("#searchCars").click(function() {
    	console.log("carcode:"+ $('#carcode').val());
    	console.log("mobile:"+ $('#mobile').val());
        console.log("carstate:"+ $('#carstate').val());
        $("#checkListTable").dataTable().fnClearTable();
        initTable();
});

//车辆审核按钮
function check_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}
//车辆上架按钮
function putaway_edit(title,url,id,w,h){
    layer_show(title,url,w,h);
}

</script>
</body>
</html>
